package com.rest.demo.response;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * @author Administrator
 * @decription
 * @Date 2017-11-10 13:35
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseEntity {

    private static final String OK = "ok";

    private static final String ERROR = "error";

    private Mata mata;

    private Object data;

    public ResponseEntity success() {
        this.mata = new Mata(true,OK);
        return this;
    }

    public ResponseEntity success(Object data) {
        this.mata = new Mata(true,OK);
        this.data = data;
        return this;
    }

    public ResponseEntity failure() {
        this.mata = new Mata(false,ERROR);
        return this;
    }

    public ResponseEntity failure(String message) {
        this.mata = new Mata(false,message);
        return this;
    }

    public Mata getMata() {
        return mata;
    }

    public Object getData() {
        return data;
    }
}
